﻿using DoNet.Core.Models;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace DoNet.System.Models
{
    /// <summary>
    /// 系统应用表，数据实体对象
    /// </summary>
    [SugarTable("Sys_App", "系统应用表")]
    [Serializable]
    public class App : TenantEntity, ICreationAudited, IModificationAudited, IDeleteAudited
    {

        #region Property APP

        /// <summary>
        /// 获取或设置 编号
        /// </summary>
        [DisplayName("编号")]
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "编号,主键")]
        public override long Id { get; set; }
        /// <summary>
        /// 应用Id
        /// </summary>
        [MaxLength(50)]
        [SugarColumn(ColumnDescription = "应用Id")]
        [Description("应用Id")]
        public virtual string AppId { get; set; } = string.Empty;

        /// <summary>
        /// 应用密钥
        /// </summary>
        [MaxLength(256)]
        [Description("应用密钥")]
        [SugarColumn(ColumnDescription = "应用密钥", Length = 64)]
        public virtual string AppSecret { get; set; } = string.Empty;

        /// <summary>
        /// 消息加解密密钥
        /// </summary>
        [MaxLength(256)]
        [Description("消息加解密密钥")]
        [SugarColumn(ColumnDescription = "消息加解密密钥", Length = 256)]
        public virtual string EncodingAESKey { get; set; } = string.Empty;

        /// <summary>
        /// 授权请求地址url
        /// </summary>
        [MaxLength(512)]
        [Description("授权请求地址url")]
        [SugarColumn(ColumnDescription = "授权请求地址url")]
        public virtual string RequestUrl { get; set; } = string.Empty;

        /// <summary>
        /// Token令牌
        /// </summary>
        [Display(Name = "Token令牌")]
        [MaxLength(64)]
        [Description("Token令牌")]
        [SugarColumn(ColumnDescription = "Token令牌", Length = 64)]
        public virtual string Token { get; set; } = string.Empty;
        /// <summary>
        /// 是否开启消息加解密
        /// </summary>
        [Display(Name = "是否开启消息加解密")]
        [Description("是否开启消息加解密")]
        [SugarColumn(ColumnDescription = "是否开启消息加解密")]
        public virtual bool IsOpenAEKey { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Display(Name = "描述")]
        [Description("描述")]
        [MaxLength(500)]
        [SugarColumn(ColumnDescription = "描述", Length = 500)]
        public virtual string Description { get; set; } = string.Empty;

        /// <summary>
        /// 有效标志
        /// </summary>
        [SugarColumn(ColumnDescription = "有效标志")]
        public virtual bool EnabledMark { get; set; }
        /// <summary>
        /// 创建日期
        /// </summary>
        [SugarColumn(ColumnDescription = "创建日期")]
        public virtual DateTime? CreatorTime { get; set; }

        /// <summary>
        /// 创建用户主键
        /// </summary>
        [SugarColumn(ColumnDescription = "创建用户主键")]
        public virtual long? CreatorUserId { get; set; }
        /// <summary>
        /// 组织机构Id
        /// </summary>
        [SugarColumn(ColumnDescription = "组织机构Id", IsOnlyIgnoreUpdate = true)]
        public long? OrganizeId { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [SugarColumn(ColumnDescription = "最后修改时间")]
        public virtual DateTime? LastModifyTime { get; set; }

        /// <summary>
        /// 最后修改用户
        /// </summary>
        [SugarColumn(ColumnDescription = "最后修改用户")]
        public virtual long? LastModifyUserId { get; set; }

        /// <summary>
        /// 删除标志
        /// </summary>
        [SugarColumn(ColumnDescription = "删除标志")]
        public virtual bool DeleteMark { get; set; }
        /// <summary>
        /// 删除时间
        /// </summary>
        [SugarColumn(ColumnDescription = "删除时间")]
        public virtual DateTime? DeleteTime { get; set; }

        /// <summary>
        /// 删除用户
        /// </summary>
        [SugarColumn(ColumnDescription = "删除用户")]
        public virtual long? DeleteUserId { get; set; }
        #endregion

    }
}
